using Engine;
using Game;

namespace SCIENEW {
    /// <summary>
    /// 普通粉末
    /// </summary>
    public class PowderItem : FlatItem, IMaterialBlock {
        public Materials Material;
        public Materials GetMaterial() => Material;
        public PowderItem(Materials type) : this(type + "Powder", MaterialsUtils.GetColor(type)) {
            Material = type;
            DisplayName = string.Format(LanguageControl.Get("Items", "Names", "PowderItem"), Material.ToDisplayName());
            Description = string.Format(LanguageControl.Get("Items", "Descriptions", "PowderItem"), Material.ToDisplayName());
        }

        public PowderItem(string id, Color color) : base(id) {
            Material = Materials.None;
            Color = color;
            DefaultTextureSlot = 198;
        }

        public override string GetCraftingId() => Id;

        public override CraftingRecipe[] GenerateProceduralRecipe(int value) {
            //锭到粉
            if (Material == Materials.None) return base.GenerateProceduralRecipe(value);
            CraftingRecipe craftingRecipe = new CraftingRecipe {
                Description = $"在粉碎机把{Material.ToDisplayName()}锭磨成粉",
                Ingredients = new string[36],
                RemainsValue = 0,
                RemainsCount = 0,
                RequiredHeatLevel = ComponentKibbler.RequiredHeatLevel,
                RequiredPlayerLevel = 0,
                ResultValue = ItemsBlockManager.GetItemID(this),
                ResultCount = 1,
            };
            craftingRecipe.Ingredients[0] = IECraftingRecipesManager.BlockToIngredient(ItemsBlockManager.GetItemIdByMaterial<MetalIngotItem>(Material));
            return [craftingRecipe];
        }
    }
}